#pragma once
#include "Polygon.h"
#include "PolyLine.h"

namespace poly
{
	// - holds info for collision detection
	// - seperation and axis are directed so that
		// to seperate, the first body needs to be moved along negative seperation
		// and the second along positive seperation
	struct Contact
	{
		float3 seperation;
		float3 axis;
		float3 point;
	};

	typedef std::list<Contact> ContactList;

	// Intersection of polygon A and polygon B
	bool intersect( Contact& contact, Polygon const & A, Polygon const & B );
	//Intersection of sphere (Center1, Radius1) and sphere (Center2, Radius2)
	bool intersect( Contact& contact, float3 center1, float radius1, float3 center2, float radius2);
	//Intersection of Polygon and sphere (center, radius)
	bool intersect( Contact& contact, Polygon const & A, float3 center, float radius );
	//Intersection of Polygon and PolyLine
	void intersect( ContactList& contactList, Polygon const & A, PolyLine const & B );

	//Intersection of two segments
	bool intersect( float3& intersection, Segment const & segment1, Segment const & segment2 );

	// returns the AND set between polygon A and -ve half space of L
	Polygon conjunction( Polygon const & A, Line const & L );

	// returns the AND set between polygon A and polygon B 
	Polygon conjunction( Polygon const & A, Polygon const & B );

} // end of poly
